import type { VabRouteRecord } from '/#/router'
import Layout from '@vab/layouts/index.vue'

export const singleRouter: VabRouteRecord = {
  path: '/single',
  name: 'single',
  component: Layout,
  meta: {
    title: '订单管理',
    icon: 'currency-line',
    guard: {
      //2021年9月份新版本，当config/settings.js中rolesControl配置开启时，用于控制角色（全写）
      role: ['singleSalesView', 'singleSalesInfo', 'singleProxyView','singleProxyInfo','addProxyOrder','printSingle'],
      mode: 'oneOf', //allOf: 数组内所有角色都拥有，返回True oneOf: 数组内拥有任一角色，返回True(等价第1种数据) except: 不拥有数组内任一角色，返回True(取反)
    },
  },
  children: [
    {
      path: 'singleSales',
      name: 'singleSales',
      component: () => import('@/views/single/singleSales.vue'),
      meta: {
        title: '销售管理',
        guard: {
          role: ['singleSalesView'],
        },
      },
    },
    {
      path: 'singleSalesInfo',
      name: 'singleSalesInfo',
      component: () => import('@/views/single/singleSalesInfo.vue'),
      meta: {
        title: '销售信息',
        hidden: true,
        tabHidden: true,
        guard: {
          role: ['singleSalesInfo'],
        },
      },
    },
    {
      path: 'singleProxy',
      name: 'singleProxy',
      component: () => import('~/src/views/single/singleProxy.vue'),
      meta: {
        title: '代客管理',
        guard: {
          role: ['singleProxyView'],
        },
      },
    },
    {
      path: 'singleProxyInfo',
      name: 'singleProxyInfo',
      component: () => import('@/views/single/singleProxyInfo.vue'),
      meta: {
        title: '代客信息',
        hidden: true,
        tabHidden: true,
        guard: {
          role: ['singleProxyInfo'],
        },
      },
    },
    {
      path: 'addProxyOrder',
      name: 'addProxyOrder',
      component: () => import('@/views/single/addProxyOrder.vue'),
      meta: {
        title: '代客下单',
        hidden: true,
        tabHidden: true,
        guard: {
          role: ['addProxyOrder'],
        },
      },
    },
    {
      path: 'printSingle',
      name: 'printSingle',
      component: () => import('@/views/single/printSingle.vue'),
      meta: {
        title: '打印销售单',
        hidden: true,
        tabHidden: true,
        noKeepAlive: true, // 不缓存该页面
      },
    },
  ],
}
